/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author GilJSA
 */
@Entity
@Table(name = "presentacion_programa")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PresentacionPrograma.findAll", query = "SELECT p FROM PresentacionPrograma p"),
    @NamedQuery(name = "PresentacionPrograma.findByIdPresentacion", query = "SELECT p FROM PresentacionPrograma p WHERE p.idPresentacion = :idPresentacion"),
    @NamedQuery(name = "PresentacionPrograma.findByIdVideo", query = "SELECT p FROM PresentacionPrograma p WHERE p.idVideo = :idVideo"),
    @NamedQuery(name = "PresentacionPrograma.findByIdDocumento", query = "SELECT p FROM PresentacionPrograma p WHERE p.idDocumento = :idDocumento")})
public class PresentacionPrograma implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPresentacion")
    private Integer idPresentacion;
    @Basic(optional = false)
    @NotNull
    @Column(name = "idVideo")
    private int idVideo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "idDocumento")
    private int idDocumento;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "presentacionProgramaidPresentacion")
    private Collection<Usuario> usuarioCollection;

    public PresentacionPrograma() {
    }

    public PresentacionPrograma(Integer idPresentacion) {
        this.idPresentacion = idPresentacion;
    }

    public PresentacionPrograma(Integer idPresentacion, int idVideo, int idDocumento) {
        this.idPresentacion = idPresentacion;
        this.idVideo = idVideo;
        this.idDocumento = idDocumento;
    }

    public Integer getIdPresentacion() {
        return idPresentacion;
    }

    public void setIdPresentacion(Integer idPresentacion) {
        this.idPresentacion = idPresentacion;
    }

    public int getIdVideo() {
        return idVideo;
    }

    public void setIdVideo(int idVideo) {
        this.idVideo = idVideo;
    }

    public int getIdDocumento() {
        return idDocumento;
    }

    public void setIdDocumento(int idDocumento) {
        this.idDocumento = idDocumento;
    }

    @XmlTransient
    public Collection<Usuario> getUsuarioCollection() {
        return usuarioCollection;
    }

    public void setUsuarioCollection(Collection<Usuario> usuarioCollection) {
        this.usuarioCollection = usuarioCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPresentacion != null ? idPresentacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PresentacionPrograma)) {
            return false;
        }
        PresentacionPrograma other = (PresentacionPrograma) object;
        if ((this.idPresentacion == null && other.idPresentacion != null) || (this.idPresentacion != null && !this.idPresentacion.equals(other.idPresentacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.PresentacionPrograma[ idPresentacion=" + idPresentacion + " ]";
    }
    
}
